using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MapCell 
{
    public int row;
    public int col;

    public bool isRoad = false;
    
    //已经在此建造的塔
    public GameObject tower;

    public Vector2 pos = Vector2.zero;
    
    /// <summary>
    /// 坐标是否在此mapCell内
    /// </summary>
    /// <param name="mousePos"></param>
    /// <returns></returns>
    public bool posIn(Vector2 mousePos)
    {
        if (mousePos.x < -col || mousePos.x>col)
        {
            return false;
        }

        if (mousePos.y < row || mousePos.y > row)
        {
            return false;
        }

        return true;
    }

    public bool canBuildTower()
    {
        if (!isRoad && tower == null)
        {
            return true;
        }

        return false;
    }


    /// <summary>
    /// 根据鼠标获取mapCell的序列
    /// </summary>
    /// <param name="mousePos"></param>
    /// <returns></returns>
    public static Vector2 getIndexByMousePos(Vector2 mousePos,int maxRow,int maxCol)
    {

        return Vector2.zero;
    }
}
